package org.bjf.config;

import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.scripting.support.ResourceScriptSource;

/**
 * @author bjf
 */
public class ScriptConfig {

  /**
   * 基于分布式脚本
   */
  public static final DefaultRedisScript<Long> LOCK_SCRIPT;

  static {
    LOCK_SCRIPT = new DefaultRedisScript<>();
    LOCK_SCRIPT.setResultType(Long.class);
    LOCK_SCRIPT.setScriptSource(new ResourceScriptSource(new ClassPathResource("script/lock.lua")));
  }
}
